package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	UserId     int     `gorm:"type:int;comment:用户id"`
	GoodsId    int     `gorm:"type:int;comment:商品id"`
	OrderSn    string  `gorm:"type:varchar(40);comment:订单号"`
	GoodsName  string  `gorm:"type:varchar(30);comment:商品名称"`
	GoodsPrice float64 `gorm:"type:decimal(10,2);comment:商品价格"`
	PayStatus  int     `gorm:"type:int;default:1;comment:支付状态:1-未支付，2-取消订单，3-已支付"`
	PayType    int     `gorm:"type:int;default:1;comment:支付方式:1-支付宝，2-微信，3-银联"`
}

func (Order) TableName() string {
	return "order"
}

func (o *Order) Created() error {
	return DB.Create(&o).Error
}
